<%@include file="includes/header.jsp" %>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="Model.*"%>
<%@page import="Controller.*"%>
<%@page import="java.sql.*" %> 
<%@page import="java.io.*" %>

<%
    String id = session.getAttribute("id").toString();
    Query q = new Query();
    ResultSet pref = q.getPref(id);


    if (pref.next()) {
        Integer disc_1 = pref.getInt("disc_1");
        Integer disc_2 = pref.getInt("disc_2");
        Integer disc_3 = pref.getInt("disc_3");

        Disciplina disc1 = q.getDisc(disc_1.toString());
        Disciplina disc2 = q.getDisc(disc_2.toString());
        Disciplina disc3 = q.getDisc(disc_3.toString());
%>
<div class="row-fluid">
    <div class="span12">
        <h1>Bem-vindo, <% out.print(session.getAttribute("nome"));%></h1>
        <hr/>        
    </div>
</div>
<div class="row-fluid">    
    <h3>Atualmente suas preferências são: </h3>
    <div class="row-fluid">
        <% if (disc1.getNome() != null) { %>
        <div class="span4 well">            
            <h5><b><% out.println(disc1.getCod());%></b> - <% out.println(disc1.getNome());%></h5>
            <hr>
            <h6><% out.println(disc1.getResumo());%></h6>
            <h6><b>Carga horária:</b> <% out.println(disc1.getCargahoraria());%>h</h6>            
        </div>
        <% } if (disc2.getNome() != null) { %>
        <div class="span4 well">
            <h5><b><% out.println(disc2.getCod());%></b> - <% out.println(disc2.getNome());%></h5>
            <hr>
            <h6><% out.println(disc2.getResumo());%></h6>
             <h6><b>Carga horária:</b> <% out.println(disc2.getCargahoraria());%>h</h6>
        </div>
        <% } if (disc3.getNome() != null) { %>
        <div class="span4 well">
            <h5><b><% out.println(disc3.getCod());%></b> - <% out.println(disc3.getNome());%></h5>
            <hr>
            <h6><% out.println(disc3.getResumo());%></h6>
                <h6><b>Carga horária:</b> <% out.println(disc3.getCargahoraria());%>h</h6>
        </div>
        <% } %>
    </div>   
</div>

<% }%>
<%@include file="includes/footer.jsp" %>
